package top.leyi.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @desc 获取指定格式的日期数据
 */

public class FormatDate {
	private static final String YMFORMAT = "YYYYMM";
	private static final String YMDFORMAT = "YYYYMMdd";
	private static final String FORMAT1 =  "yyyy-MM-dd hh:mm:ss";
	public static String getYMFormatDate(){
		Date date = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(YMFORMAT);
		return dateFormat.format(date);
	}
	/// 2017-12-27 00:00:00
	public static String getFormat1Date(){
		Date date = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT1);
		return dateFormat.format(date);
	}
	public static String getYMDFormat1Date(){
		Date date = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(YMDFORMAT);
		return dateFormat.format(date);
	}
	public static long getCurrentTime(){
	    return System.currentTimeMillis();
	}
	

	public static void main(String[] args){
       System.out.println(getYMFormatDate());
       System.out.println(getCurrentTime());
       System.out.println(RandomString.getRandomString(5));
	}
	
}

